package com.netease.framework;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.netease.pris.app.PrisApp;
import java.util.WeakHashMap;

public class k
{
  public static final String a = "pris\\.skin\\..*";
  public static final String b = "internal\\.skin\\..*";
  public static final String c = "internal.skin.black";
  private static final String d = "SkinManager";
  private static k e = null;
  private static int[] f;
  private static int[] g;
  private static int[] h;
  private static int[] i;
  private static int[] j;
  private Context k = null;
  private h l;
  private Resources m;
  private l n;
  private WeakHashMap o = new WeakHashMap();
  private String p;
  private PackageManager q;

  static
  {
    int[] arrayOfInt1 = new int[1];
    arrayOfInt1[0] = 16842964;
    f = arrayOfInt1;
    int[] arrayOfInt2 = new int[1];
    arrayOfInt2[0] = 16842904;
    g = arrayOfInt2;
    int[] arrayOfInt3 = new int[1];
    arrayOfInt3[0] = 16843049;
    h = arrayOfInt3;
    int[] arrayOfInt4 = new int[1];
    arrayOfInt4[0] = 16843033;
    i = arrayOfInt4;
    int[] arrayOfInt5 = new int[1];
    arrayOfInt5[0] = 16842804;
    j = arrayOfInt5;
  }

  private k(Context paramContext)
  {
    this.k = paramContext;
    this.m = this.k.getResources();
    this.p = this.k.getPackageName();
    this.q = this.k.getPackageManager();
    a();
  }

  public static k a(Context paramContext)
  {
    if (e != null);
    for (k localk = e; ; localk = e)
    {
      return localk;
      b(paramContext);
    }
  }

  public static void a(View paramView, Drawable paramDrawable)
  {
    if ((paramView == null) || (paramDrawable == null));
    while (true)
    {
      return;
      int i1 = paramView.getPaddingLeft();
      int i2 = paramView.getPaddingTop();
      int i3 = paramView.getPaddingRight();
      int i4 = paramView.getPaddingBottom();
      paramView.setBackgroundDrawable(paramDrawable);
      paramView.setPadding(i1, i2, i3, i4);
    }
  }

  private void a(View paramView, b paramb)
  {
    if ((paramView == null) || (paramb == null))
      return;
    int i1 = paramb.a();
    if (i1 > 0)
      if ((paramView.findViewById(2131558423) == null) && (paramView.getId() != 2131558423))
        break label158;
    label158: for (int i5 = 1; ; i5 = 0)
    {
      Drawable localDrawable = b(i1);
      if ((i5 != 0) && (localDrawable != null));
      a(paramView, localDrawable);
      int i2 = paramb.b();
      if ((i2 > 0) && ((paramView instanceof TextView)))
        ((TextView)paramView).setTextColor(c(i2));
      int i3 = paramb.c();
      if ((i3 > 0) && ((paramView instanceof ListView)))
        ((ListView)paramView).setDivider(b(i3));
      int i4 = paramb.d();
      if ((i4 <= 0) || (!(paramView instanceof ImageView)))
        break;
      ((ImageView)paramView).setImageDrawable(b(i4));
      break;
    }
  }

  private static void b(Context paramContext)
  {
    e = null;
    if (paramContext != null)
      e = new k(paramContext.getApplicationContext());
  }

  public int a(int paramInt)
  {
    if (this.l == null);
    while (true)
    {
      return paramInt;
      int i1 = this.l.c(paramInt);
      if (i1 <= 0)
        continue;
      paramInt = i1;
    }
  }

  public l a(String paramString)
  {
    l locall = null;
    if (TextUtils.isEmpty(paramString));
    while (true)
    {
      return locall;
      try
      {
        PackageInfo localPackageInfo2 = this.q.getPackageInfo(paramString, 1);
        localPackageInfo1 = localPackageInfo2;
        locall = a(null, this.q, localPackageInfo1, true);
      }
      catch (PackageManager.NameNotFoundException localNameNotFoundException)
      {
        while (true)
        {
          localNameNotFoundException.printStackTrace();
          PackageInfo localPackageInfo1 = null;
        }
      }
    }
  }

  public l a(String paramString, PackageManager paramPackageManager, PackageInfo paramPackageInfo, boolean paramBoolean)
  {
    if ((paramPackageManager == null) || (paramPackageInfo == null))
    {
      locall = null;
      return locall;
    }
    l locall = new l();
    locall.a(paramString);
    ApplicationInfo localApplicationInfo = paramPackageInfo.applicationInfo;
    String str = localApplicationInfo.packageName;
    locall.b(str);
    if (this.p.equals(str))
    {
      locall.c(null);
      locall.a(this.k.getResources().getDrawable(2130837598));
    }
    while (true)
    {
      locall.d(paramPackageInfo.versionName);
      locall.a(paramBoolean);
      locall.b(str.equals(PrisApp.a().A()));
      break;
      locall.c(paramPackageManager.getApplicationLabel(localApplicationInfo).toString());
      locall.a(paramPackageManager.getApplicationIcon(localApplicationInfo));
    }
  }

  public void a()
  {
    String str = PrisApp.a().A();
    if ((TextUtils.isEmpty(str)) || (this.p.equals(str)))
      this.n = f();
    while (true)
    {
      return;
      if (str.equals("internal.skin.black"))
      {
        this.n = PrisApp.a().B();
        continue;
      }
      l locall = a(str);
      if (locall == null)
        locall = f();
      this.n = locall;
    }
  }

  public void a(View paramView, AttributeSet paramAttributeSet)
  {
    if ((paramView == null) || (paramAttributeSet == null));
    while (true)
    {
      return;
      b localb = new b(this, null);
      TypedArray localTypedArray1 = paramView.getContext().obtainStyledAttributes(paramAttributeSet, f);
      TypedValue localTypedValue1 = localTypedArray1.peekValue(0);
      if ((localTypedValue1 != null) && (localTypedValue1.resourceId != 0))
        localb.a(localTypedValue1.resourceId);
      localTypedArray1.recycle();
      TypedArray localTypedArray2 = paramView.getContext().obtainStyledAttributes(paramAttributeSet, g);
      TypedValue localTypedValue2 = localTypedArray2.peekValue(0);
      if ((localTypedValue2 != null) && (localTypedValue2.resourceId != 0))
        localb.b(localTypedValue2.resourceId);
      localTypedArray2.recycle();
      TypedArray localTypedArray3 = paramView.getContext().obtainStyledAttributes(paramAttributeSet, h);
      TypedValue localTypedValue3 = localTypedArray3.peekValue(0);
      if ((localTypedValue3 != null) && (localTypedValue3.resourceId != 0))
        localb.c(localTypedValue3.resourceId);
      localTypedArray3.recycle();
      TypedArray localTypedArray4 = paramView.getContext().obtainStyledAttributes(paramAttributeSet, i);
      TypedValue localTypedValue4 = localTypedArray4.peekValue(0);
      if ((localTypedValue4 != null) && (localTypedValue4.resourceId != 0))
        localb.d(localTypedValue4.resourceId);
      localTypedArray4.recycle();
      synchronized (this.o)
      {
        this.o.put(paramView, localb);
        if (c())
          continue;
        a(paramView, localb);
      }
    }
  }

  public void a(h paramh)
  {
    this.l = paramh;
    if (this.l == null)
      this.n = f();
  }

  public void a(l paraml)
  {
    if (paraml == null)
      paraml = f();
    this.n = paraml;
  }

  public Drawable b(int paramInt)
  {
    Object localObject;
    if (this.l == null)
      localObject = this.m.getDrawable(paramInt);
    while (true)
    {
      return localObject;
      try
      {
        Drawable localDrawable = this.l.a(paramInt);
        localObject = localDrawable;
        if ((localObject == null) && (localObject != null))
          continue;
        localObject = this.m.getDrawable(paramInt);
      }
      catch (Resources.NotFoundException localNotFoundException)
      {
        localObject = this.m.getDrawable(paramInt);
      }
    }
  }

  public l b()
  {
    if (this.n == null)
      this.n = f();
    return this.n;
  }

  public int c(int paramInt)
  {
    int i1;
    if (this.l == null)
      i1 = this.m.getColor(paramInt);
    while (true)
    {
      return i1;
      try
      {
        int i2 = this.l.b(paramInt);
        i1 = i2;
      }
      catch (Resources.NotFoundException localNotFoundException)
      {
        i1 = this.m.getColor(paramInt);
      }
    }
  }

  public boolean c()
  {
    if (this.n == null)
      this.n = f();
    for (boolean bool = true; ; bool = this.p.equals(this.n.b()))
      return bool;
  }

  public h d()
  {
    return this.l;
  }

  // ERROR //
  public void e()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 68	com/netease/framework/k:o	Ljava/util/WeakHashMap;
    //   4: astore_1
    //   5: aload_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 68	com/netease/framework/k:o	Ljava/util/WeakHashMap;
    //   11: invokevirtual 326	java/util/WeakHashMap:size	()I
    //   14: pop
    //   15: aload_0
    //   16: getfield 68	com/netease/framework/k:o	Ljava/util/WeakHashMap;
    //   19: invokevirtual 330	java/util/WeakHashMap:entrySet	()Ljava/util/Set;
    //   22: invokeinterface 336 1 0
    //   27: astore 4
    //   29: aload 4
    //   31: invokeinterface 341 1 0
    //   36: ifeq +60 -> 96
    //   39: aload 4
    //   41: invokeinterface 345 1 0
    //   46: checkcast 347	java/util/Map$Entry
    //   49: astore 5
    //   51: aload 5
    //   53: invokeinterface 350 1 0
    //   58: checkcast 96	android/view/View
    //   61: astore 6
    //   63: aload 5
    //   65: invokeinterface 353 1 0
    //   70: checkcast 120	com/netease/framework/b
    //   73: astore 7
    //   75: aload 7
    //   77: ifnull -48 -> 29
    //   80: aload_0
    //   81: aload 6
    //   83: aload 7
    //   85: invokespecial 309	com/netease/framework/k:a	(Landroid/view/View;Lcom/netease/framework/b;)V
    //   88: goto -59 -> 29
    //   91: astore_2
    //   92: aload_1
    //   93: monitorexit
    //   94: aload_2
    //   95: athrow
    //   96: aload_1
    //   97: monitorexit
    //   98: return
    //
    // Exception table:
    //   from	to	target	type
    //   7	94	91	finally
    //   96	98	91	finally
  }

  public l f()
  {
    try
    {
      PackageInfo localPackageInfo2 = this.q.getPackageInfo(this.k.getPackageName(), 0);
      localPackageInfo1 = localPackageInfo2;
      return a(null, this.q, localPackageInfo1, true);
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      while (true)
      {
        localNameNotFoundException.printStackTrace();
        PackageInfo localPackageInfo1 = null;
      }
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.framework.k
 * JD-Core Version:    0.6.0
 */